#include <bits/stdc++.h>
#define dump(x) printf("%s=%d\n", #x,x);

using std::swap;
using std::sort;

const int maxn=100005;
const int maxm=1000005;
const int maxq=100005;
const int mxnd=maxn+maxm;

struct iostream{
    const static int bufsiz=100005;
    char in[bufsiz],out[bufsiz];
    FILE *i,*o;
    iostream(FILE *i,FILE *o):i(i),o(o){}
    inline char getc(){
        static int pos=bufsiz,end=bufsiz;
        if(pos==end) end=fread(in,1,bufsiz,i),pos=0;
        if(pos==end) return EOF;
        else return in[pos++];
    }
    template <typename T> inline iostream& operator >> (T &r){
        char c;bool f=0;
        for(c=getc();c>'9'||c<'0';c=getc()) if(c=='-') f=1;
        for(r=0;c<='9'&&c>='0';c=getc()) r=r*10+c-'0';
        if(f) r=-r;
        return *this;
    }
    inline void putc(const char &c){
        static int pos=0;
        if(c) out[pos++]=c;
        if(pos==bufsiz||(!c)) fwrite(out,1,pos,o),pos=0;
    }
    template <typename T> inline iostream& operator << (T t){
        static int sta[50];
        if(t<0) putc('-'),t=-t;
        int len=0;
        while(t) sta[len++]=t%10,t/=10;
        if(!len) putc('0');
        else while(len--) putc(sta[len]+'0');
        return *this;
    }
    inline void operator ++(int) {putc('\n');}
    ~iostream(){
        putc(0);
        fclose(i);fclose(o);
    }
};

struct E{
    int u,v,w,id;bool del;
    const bool operator < (const E &e) const{return w<e.w||w==e.w&&id<e.id;} 
};
struct Q{ int f,x,y;
    union{
        int edgeID,ans;
    }val;
};

iostream io(stdin,stdout);
int usFa[maxn];
int fa[mxnd],val[mxnd],mx[mxnd],ch[mxnd][2],rev[mxnd];
E edge[maxm];Q query[maxq];

inline const bool cmp(const E &x,const E &y){   return x.u==y.u?x.v<y.v:x.u<y.u;}
int getF(const int &x){return usFa[x]==x?x:usFa[x]=getF(usFa[x]);}
void update(int p){
    mx[p]=p;
    int t=val[mx[ch[p][0]]]>val[mx[ch[p][1]]]?mx[ch[p][0]]:mx[ch[p][1]];
    if(val[t]>val[p]) mx[p]=t;
}
void reverse(int p){rev[p]^=1;swap(ch[p][0],ch[p][1]);}
void pushdown(int p){if(rev[p]){rev[p]=0;reverse(ch[p][0]);reverse(ch[p][1]);}}
bool isroot(int p){return ch[fa[p]][0]!=p&&ch[fa[p]][1]!=p;}

void rotate(int p){
    int f=fa[p],g=fa[f];
    int x=ch[f][1]==p,y=ch[g][1]==f;
    fa[p]=g;if(!isroot(f)) ch[g][y]=p;
    if(ch[f][x]=ch[p][x^1]) fa[ch[p][x^1]]=f;
    ch[p][x^1]=f;fa[f]=p;
    update(f);
    if(fa[p]==p){
        * (int *) 0x0 = 100;
    }
}
void splay(int p){
    static int sta[mxnd];
    int t=p,head=0;
    while(!isroot(t)) sta[head++]=t,t=fa[t];
    sta[head++]=t;
    while(head--) pushdown(sta[head]);

    while(!isroot(p)){
        int f=fa[p],g=fa[f];
        int x=ch[f][1]==p,y=ch[g][1]==f;
        if(!isroot(f)){
            if(x==y) rotate(f);
            else rotate(p);
        }
        rotate(p);
    }
    update(p);
}
void access(int p){
    for(int son=0;p;son=p,p=fa[p]){
        splay(p);ch[p][1]=son;update(p);
    }
}
void makeroot(int p){
    access(p);splay(p);reverse(p);
}
void link(int p,int q){
    makeroot(p);fa[p]=q;
}
void cut(int p,int q){
    makeroot(p);access(q);splay(q);
    if(ch[q][0]==p) fa[p]=ch[q][0]=0;
    update(q);
}

int bisearch(int u,int v,const int &m){
    int l,r;
    l=1;r=m;
    while(l<r){
        int mid=(l+r)>>1;
        if(edge[mid].u<u||edge[mid].u==u&&edge[mid].v<v) l=mid+1;
        else r=mid;
    }
    assert(edge[l].u==u&&edge[l].v==v);
    return l;
}

int main(){
    int n,m,q;

    freopen("2594.in","r",stdin);
    freopen("2594.out","w",stdout);

    io>>n>>m>>q;
    for(int i=1;i<=m;i++){
        io>>edge[i].u>>edge[i].v>>edge[i].w;
        if(edge[i].u>edge[i].v) swap(edge[i].u,edge[i].v);
    }
    sort(edge+1,edge+1+m,cmp);
    for(int i=1;i<=m;i++){
        edge[i].id=i;
        val[i+n]=edge[i].w;
        mx[i+n]=i+n;
    }
    for(int i=1;i<=q;i++){
        io>>query[i].f>>query[i].x>>query[i].y;
        if(query[i].x>query[i].y) swap(query[i].x,query[i].y);
        if(query[i].f==2){
            edge[query[i].val.edgeID=bisearch(query[i].x,query[i].y,m)].del=1;
        }
    }

    sort(edge+1,edge+1+m);
    for(int i=1;i<=n;i++) usFa[i]=i;
    for(int i=1,cnt=1;i<=m&&cnt<n;i++){
        if(edge[i].del==1) continue;
        if(getF(edge[i].u)!=getF(edge[i].v)){
            link(edge[i].u,edge[i].id+n);link(edge[i].v,edge[i].id+n);
            usFa[getF(edge[i].u)]=getF(edge[i].v);
        }
    }

    sort(edge+1,edge+1+m,cmp);
    for(int i=q;i;i--){
        makeroot(query[i].x);access(query[i].y);splay(query[i].y);
        if(query[i].f==1){
            query[i].val.ans=val[mx[query[i].y]];
        }else{
            int t=mx[query[i].y],d=query[i].val.edgeID;
            t-=n;
            if(val[t+n]>edge[d].w){
                cut(edge[t].u,t+n);cut(edge[t].v,t+n);
                link(edge[d].u,d+n);link(edge[d].v,d+n);
            }
        }
    }

    for(int i=1;i<=q;i++) if(query[i].f==1) io<<query[i].val.ans,io++;

    return 0;
}